using System;
using System.Collections;
using System.Drawing.Design;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Web.UI.Design;
using System.Collections.Generic;

namespace OpenSource.Web.WebToolbar
{
	/// <summary>
	/// Summary description for WebToolbarItem.
	/// </summary>
	public class WebToolbarItem
	{
		public WebToolbarItem()
		{
			normalImageUrl = "";
			hoverImageUrl = "";
			pressedImageUrl = "";
			disabledImageUrl = "";
			clientScript = "";
			name = "";
			enabled = true;
			serverSideClick = true;
			confirm = "";
			separator = false;
			statusText = "";
		}

		private string name;
		private string normalImageUrl;
		private string hoverImageUrl;
		private string pressedImageUrl;
		private string disabledImageUrl;
		private bool serverSideClick;
		private string clientScript;
		private string toolTip;
		private bool enabled;
		private string confirm;
		private bool separator;
		private string statusText;
		

		[Category("Appearance"),
		DefaultValue("")]
		public string Name
		{
			get { return name; }
			set { name = value; }
		}

		[Category("Appearance"),
		DefaultValue(""), Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
		public string NormalImgeUrl
		{
			get { return normalImageUrl; }
			set { normalImageUrl = value; }
		}

		[Category("Appearance"),
		DefaultValue(""), Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
		public string HoverImageUrl
		{
			get { return hoverImageUrl; }
			set { hoverImageUrl = value; }
		}

		[Category("Appearance"),
		DefaultValue(""), Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
		public string PressedImageUrl
		{
			get { return pressedImageUrl; }
			set { pressedImageUrl = value; }
		}

		[Category("Appearance"),
		DefaultValue(""), Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
		public string DisabledImageUrl
		{
			get { return disabledImageUrl; }
			set { disabledImageUrl = value; }
		}

		[Category("Behavior"),
		DefaultValue("")]
		public string ClientScript
		{
			get { return clientScript; }
			set { clientScript = value; }
		}

		[Category( "Behavior" ),
		DefaultValue( "" )]
		public string ToolTip
		{
			get { return toolTip; }
			set { toolTip = value; }
		}

		[Category( "Behavior" ),
		DefaultValue( "" )]
		public string StatusText
		{
			get { return statusText; }
			set { statusText = value; }
		}

		[Category( "Behavior" ),
		DefaultValue(true)]
		public bool Enabled
		{
			get { return enabled; }
			set { enabled = value; }
		}

		[Category("Behavior"),
		DefaultValue(true)]
		public bool ServerSideClick
		{
			get { return serverSideClick; }
			set { serverSideClick = value; }
		}

		[Category( "Behavior" ),
		DefaultValue( "" )]
		public string ConfirmMessage
		{
			get { return confirm; }
			set { confirm = value; }
		}
		[Category( "Behavior" ),
		DefaultValue( false )]
		public bool Separator
		{
			get { return separator; }
			set { separator = value; }
		}
	}


	public class WebToolbarItemCollection : List<WebToolbarItem>
	{
	}


	public class WebToolbarItemCollectionEditor : CollectionEditor
	{
		public WebToolbarItemCollectionEditor(Type type)
			: base(type)
		{
		}

		protected override bool CanSelectMultipleInstances()
		{
			return true;
		}

		protected override Type CreateCollectionItemType()
		{
			return typeof(WebToolbarItem);
		}

	}

}
